<?php

namespace app\validate\property\unit;

use think\Validate;

class PropertyUnitValidate extends Validate
{
    protected $rule = [
        'property_id|物业信息' => 'require|number',
    ];


    public function sceneAdd()
    {
        return $this->remove('id', 'require');
    }

    public function sceneEdit()
    {
        return $this->remove('name', 'require');
    }

    public function sceneDel()
    {
        return $this->only(['id'])->append('id', 'require|number');
    }

    /**
     *  添加楼栋
     * @return PropertyUnitValidate
     *
     * @author Amos
     * 2024-10-06 17:34
     */
    public function sceneAddLouDong()
    {
        return $this->only(['property_id', 'unit_name', 'unit_code', 'building_area'])
            ->append('property_id|物业信息', 'require|number')
            ->append('unit_name|楼栋信息', 'require')
            ->append('unit_code|楼栋编号', 'require')
            ->append('building_area|建筑面积', 'require');
    }

    /**
     * 添加单元
     * @return PropertyUnitValidate
     *
     * @author Amos
     * 2024-10-06 17:35
     */
    public function sceneAddUnit()
    {
        return $this->only(['property_id', 'unit_name', 'unit_code'])
            ->append('property_id|物业信息', 'require|number')
            ->append('pid|楼栋信息', 'require')
            ->append('unit_name|单元名称', 'require')
            ->append('unit_code|单元编号', 'require');
    }
}